import Cookies from 'js-cookie'

const useDynamicAppStore = (name: string) => {
  return defineStore(name, {
    state: () => ({
      size: parseInt(Cookies.get(name) as string) || 0
    }),
    actions: {
      setSize(size: number) {
        this.size = size
        Cookies.set(name, size.toString())
      }
    }
  })
}
export default useDynamicAppStore
